home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / vesatp11 / example / example1.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-04-04  |  1.5 KB  |  70 lines

  1. {$R+}
  2.  
  3. {$DEFINE vgraph}
  4.  
  5. PROGRAM example1;
  6. USES
  7. {$IFDEF vgraph}
  8.     VGraph
  9. {$ELSE}
  10.     Graph
  11. {$ENDIF}
  12.     ,Crt;
  13.  
  14. CONST
  15.     a : ARRAY[0..3] OF REAL = (0.85,0.2,-0.15,0);
  16.    b : ARRAY[0..3] OF REAL = (0.04,-0.26,0.28,0);
  17.    c : ARRAY[0..3] OF REAL = (-0.04,0.23,0.24,0.16);
  18.    d : ARRAY[0..3] OF REAL = (0.85,0.22,0.24,0.16);
  19.    e : ARRAY[0..3] OF REAL = (0,0,0,0);
  20.    f : ARRAY[0..3] OF REAL = (1.6,1.6,0.44,0);
  21.    p : ARRAY[0..3] OF REAL = (85,92,99,100);
  22.    x : REAL = 0;
  23.    y : REAL = 0;
  24.    xx: REAL = 0;
  25.    l : INTEGER = 0;
  26.    k : INTEGER = 0;
  27.  
  28. VAR
  29.    i,j    : INTEGER;
  30.    ready : BOOLEAN;
  31.  
  32.    grDriver,grMode    : INTEGER;
  33. BEGIN
  34.     { Select a video mode }
  35. {$IFDEF vgraph}
  36.    InitVesa(V640x480x256);
  37.    { Set background to dark and drawing color to light }
  38.    SetRGBPal(0,0,0,0);
  39.    SetRGBPal(1,255,255,255);
  40. {$ELSE}
  41.    grDriver := detect;
  42.    InitGraph(grDriver,grMode,'');
  43. {$ENDIF}
  44.    REPEAT
  45.        FOR i := 1 TO 2000 DO BEGIN
  46.            l := Random(MaxInt) MOD 100+1;
  47.           ready := FALSE;
  48.           j := 0;
  49.           WHILE NOT ready DO BEGIN
  50.               IF l<=p[j] THEN BEGIN
  51.                  k := j;
  52.                 ready := TRUE;
  53.              END;
  54.              Inc(j);
  55.           END;
  56.           xx:= a[k]*x + b[k]*y + e[k];
  57.           y := c[k]*x + d[k]*y + f[k];
  58.           x := xx;
  59.           IF (i>10) THEN
  60.                 PutPixel(Trunc(x*40+300),Trunc(469-y*40),1);
  61.           Inc(i);
  62.        END;
  63.    UNTIL KeyPressed;
  64.    { Clean up the mess - release memory and so on }
  65. {$IFDEF vgraph}
  66.    CloseVesa;
  67. {$ELSE}
  68.    CloseGraph;
  69. {$ENDIF}
  70. END.